import { useEffect,useState } from "react";

 

  function filterMenu(menu) {
    console.log(menu);
    let level = 0
    return handelmenu(menu)
    function handelmenu(menu) {
        return menu.map((item, index) => {
            const o = {
                title: item.title,
                key: item.key,
            }
            if (item.children) {
                level++
                o.children = handelmenu(item.children)
                o.key = `${o.key}`
                level = 0
            }
            // if (item.icon) {
            //     o.icon = <i style={{ display: 'inline-block' }} className={'iconfont iconfont-' + item.icon}></i >
            // }
            return o
        })
    }
}
export default filterMenu


